package com.tij.rtti.typeinfo.pet;

import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

/**
 * @ClassName: ch 14-3-1 p327
 * @author:
 * @Description: TODO
 * data:2024/10/7 6:48
 * @since
 **/
public class LiteralPetCreator extends PetCreator{
    public static final List<Class<? extends Pet>> allTypes =
            Collections.unmodifiableList(Arrays.asList(
                    Pet.class,Dog.class,Cat.class,Rodent.class,
                    Mutt.class,Pug.class,EgyptianMau.class,Manx.class
                    ,Cymric.class,Rat.class,Mouse.class,Hamster.class
            ));
    // unmodifiableList 不可变list
    private static final List<Class<? extends  Pet>> types =
            allTypes.subList(allTypes.indexOf(Mutt.class),allTypes.size());
    //subList ? 截取出一个list
    //allTypes.indexOf(Mutt.class) ?   获取对应的序列编号

    public static void main(String[] args) {
        System.out.println(new LiteralPetCreator().types());
    }

    @Override
    public List<Class<? extends Pet>> types() {
        return types;
    }
}
